package context.environ;

import context.util.Timer;

public class Time
{
    
    private static Time singleton = new Time();
    
    public static Time get()
    {
        return Time.singleton;
    }
    
    private Time()
    {
    }
    
    
    private Timer mTimer;
    
    private double mDelta;
    
    private double mTime;
    
    
    public void onStart()
    {
        this.mTimer = new Timer();
        this.mTimer.start();
        
        this.mDelta = 0;
        this.mTime = 0;
    }
    
    public void onTick()
    {
        this.mDelta = this.mTimer.delta();
        this.mTime += this.mDelta;
    }
    
    public void onEnd()
    {
        this.mTimer.clear();
        this.mTimer = null;
        this.mDelta = 0;
        this.mTime = 0;
    }
    
    
    public double delta()
    {
        return this.mDelta;
    }
    
    public double time()
    {
        return this.mTime;
    }
    
}
